package xyz.huangziheng.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import xyz.huangziheng.entity.Department;
import xyz.huangziheng.service.DepartmentService;

import java.util.List;

@Controller
@RequestMapping("/emp")
public class DepartmentController {
    @Autowired
    private DepartmentService departmentService;

    @RequestMapping("/list")
    @ResponseBody
    public List<Department> getAll() {
        List<Department> all = departmentService.findAll();
        System.out.println(all);
        return all;
    }
}
